package com.oyjd.business.splash.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;

import com.oyjd.R;
import com.oyjd.business.listview.activity.ChengJiFileListActivity;
import com.oyjd.business.listview.service.ChengJiService;

/**
 * 首页展示
 * 
 * @author 欧建东
 * @email oyjd@163.com
 * 
 */
public class SplashActivity extends Activity {

	/**
	 * 组件创建
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.act_splash);

		task.execute();
	}

	/**
	 * 异步任务初始化环境
	 */
	private AsyncTask<Integer, Integer, Boolean> task = new AsyncTask<Integer, Integer, Boolean>() {
		@Override
		protected Boolean doInBackground(Integer... params) {
			boolean flag = false;
			try {
				ChengJiService.createDemo();
				Thread.sleep(2000L);
				flag = true;
			} catch (Exception e) {
				e.printStackTrace();
			}
			return flag;
		}

		@Override
		protected void onPostExecute(Boolean flag) {
			Intent intent = new Intent(SplashActivity.this, ChengJiFileListActivity.class);
			startActivity(intent);
			finish();
		}
	};
}
